<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>标题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/statics/layui/font/font.css" media="all"/>
    <link rel="stylesheet" href="/static/css/buildUnit/common.css">
    <style type="text/css">
        html, body {
            height: 100%;
        }

        .chooseBox {
            border: 1px solid #333;
            height: 300px;
            padding: 10px;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            overflow-y: auto;
        }

        .leftBox > p {
            line-height: 30px;
            padding-left: 20px;
            cursor: pointer;
        }

        .leftBox > p:hover {
            background: #ddd;
        }

        .leftBox > p.selected {
            background: #d5d5d5;
        }

        .editTr {
            display: none;
        }
    </style>
</head>
<body>
<div>
    <form id="form" class="layui-form layui-form-pane" action="" lay-filter="example">
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">人员基本信息</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-table v-table">
                        <tbody>
                        <tr class="hide">
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                            <td width="24%"></td>
                            <td width="13%"></td>
                            <td width="13%"></td>
                        </tr>
                        <tr>
                            <td class="th8">人员姓名</td>
                            <td colspan="2">
                                <input type="hidden" name="userId" class="formData">
                                <input name="realName" type="text" class="layui-input layui-disabled formData" disabled>
                            </td>
                            <td class="th8">性别</td>
                            <td colspan="2">
                                <input name="gender" type="text" class="layui-input layui-disabled formData"
                                       disabled>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8">身份证号</td>
                            <td colspan="2">
                                <input name="userCard" type="text" class="layui-input layui-disabled formData" disabled>
                            </td>
                            <td class="th8">民族</td>
                            <td colspan="2">
                                <input name="nation" type="text" class="layui-input layui-disabled formData"
                                       disabled>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8">出生日期</td>
                            <td colspan="2">
                                <input name="birthDate" type="text" class="layui-input layui-disabled formData"
                                       disabled>
                            </td>
                            <td class="th8">手机号码</td>
                            <td colspan="2">
                                <input name="contact" type="text" class="layui-input layui-disabled formData" disabled>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8">电子邮箱</td>
                            <td colspan="2">
                                <input name="email" type="text" class="layui-input layui-disabled formData" disabled>
                            </td>
                        </tr>
                        <tr>
                            <td class="th8 required">聘用职务</td>
                            <td colspan="2">
                                <select name="seal" id="seal" class="formData" lay-verify="isEmpty">
                                    <option value=""></option>
                                </select>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-collapse">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">资质证书</h2>
                <div class="layui-colla-content layui-show">
                    <table class="layui-hide" id="dataList" lay-filter="dataList"></table>
                </div>
            </div>
        </div>
        <button lay-submit lay-filter="submit" style="display: none;" id="submit" class="demo1">提交</button>
    </form>
</div>
<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<!--<script type="text/javascript" src="../../../statics/js/sys/editDict.js"  charset="utf-8"></script>-->
<script>
    layui.use(['form', 'sessionFun', 'configure', 'configureCom', 'laydate', 'matchDict', 'element'], function () {
        window.$ = layui.$;
        var form = layui.form;
        var configure = layui.configure;
        var laydate = layui.laydate;
        var configureCom = layui.configureCom;
        var sessionFun = layui.sessionFun;
        var matchDict = layui.matchDict;
        var userCard = configureCom.GetQueryString('userCard');//接受所有框中信息
        var data = {};
        $('.time').each(function (index, item) {
            laydate.render({
                elem: item, //指定元素
                trigger: 'click'
            });
        });
        configureCom.postDataAjax(configure.COM_SEARCH_QUALI_USER_HTTP, {userCard: userCard}).then(function (res) {
            console.log(res.list[0]);
            data = res.list[0];
            data.gender = matchDict.name(res.list[0].gender, configure.SEX);
            data.nation = matchDict.name(res.list[0].nation, configure.NATION_CODE);
            configureCom.selectDataFun(configure.DUTY_TYPE_CODE, '', '#seal');
            form.val('example', data);
            configureCom.postDataAjax(configure.ZIZHI_USER_CERT_LIST_HTTP, {userId: data.userId}).then(function (res) {
                var cols = [[
                    {
                        field: 'registerType', title: '证书类别', templet: function (d) {
                            return '<p>' + matchDict.name(d.registerType, configure.CERT_TYPE_CODE) + '</p>'
                        }
                    },
                    {field: 'aptitudeNumber', title: '证书编号'},
                    {field: 'grantTime', title: '发证日期'},
                    {field: 'aptitudeOrg', title: '发证机关'},
                    {
                        field: 'aptitudeStatus', title: '状态', templet: function (d) {
                            return '<p>' + matchDict.name(d.aptitudeStatus, configure.USER_APTITUDE_STATUS) + '</p>';
                        }
                    }
                ]];
                configureCom.tableRenderUserDefined({}, cols, res.list, 'dataList', '', true);
            });
        });
        form.render();

        form.on('submit(submit)', function (data) {
            return false;
        });
    });

    function getData() {
        return new Promise(function (res, rej) {
            var data = {};
            if (!window.formVerifyFun()) {
                return false;
            }
            $('.formData').each(function (index, item) {
                var key = $(item).attr('name');
                data[key] = $(item).val();
            });
            res({result: data});
        });
    }
</script>
</body>
</html>
